package cn.hxth.cloud.datasync.rabbitmq;

import cn.hxth.cloud.api.domain.OrderInfo;
import cn.hxth.cloud.api.rabbitmq.AbstractRabbitMQHandler;
import cn.hxth.cloud.api.rabbitmq.RabbitMQSender;
import cn.hxth.cloud.service.service.InventoryService;
import cn.hxth.cloud.service.service.OrderService;
import cn.hxth.cloud.service.service.ProductionService;
import cn.hxth.cloud.service.service.WmsService;
import com.alibaba.fastjson.JSONObject;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

@Component
@RabbitListener(queues = "data-change-queue-order")
public class DataChangeQueueReceiver extends AbstractRabbitMQHandler {
    @Autowired
    public DataChangeQueueReceiver(RabbitMQSender rabbitMQSender) {
        super(rabbitMQSender);
        super.setLogger(DataChangeQueueReceiver.class);
    }

    @Autowired
    private OrderService orderService;
    @Autowired
    private InventoryService inventoryService;
    @Autowired
    private ProductionService productionService;
    @Autowired
    private WmsService wmsService;
    /*@Resource
    private WmsFacadeService wmsFacadeService ;*/
    @Autowired
    private RedisTemplate<String, String> redisTemplate;
    @Autowired
    private RabbitMQSender rabbitMQSender ;

    private Boolean processOrderUpdateOrderStatus(JSONObject jsonObject, String jsonData) {


        OrderInfo orderInfo = JSONObject.parseObject(jsonData, OrderInfo.class);
        Boolean flag = this.orderService.updateStatus(orderInfo);
        return flag;


    }



}
